<!DOCTYPE html>
<html>
<head>
    <title>代码生成</title>
    <link href="https://iotechn.oss-cn-hangzhou.aliyuncs.com/open/style/commons.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="https://iotechn.oss-cn-hangzhou.aliyuncs.com/open/stylesheets/commons.css">
    <link rel="stylesheet" type="text/css" href="https://iotechn.oss-cn-hangzhou.aliyuncs.com/open/stylesheets/index-news.css">
    <script src="https://iotechn.oss-cn-hangzhou.aliyuncs.com/open/js/jquery-lastest.js"></script>
</head><body>
<!--<div class="open-header clearfix">-->
    <!--<div class="pm">-->
        <!--<div class="open-header-c1 fl">-->
            <!--&lt;!&ndash; logo &ndash;&gt;-->
            <!--<a href="/"><span class='open-header-icon'></span></a>-->
        <!--</div>-->
    <!--</div>-->
<!--</div>-->
<div class="open-nav">
    <div class="pm">
        <!-- 横向导航栏 -->
        <ul class="openapi-nav">
            <!--<li class="openapi-nav-index"><a href="/index">首页</a></li>-->
            <li class="openapi-nav-apis" type=""><a href="#">代码生成</a></li>
            <!--<li class="openapi-nav-docs"><a href="/docs">文档</a></li>-->
        </ul>
    </div>
</div>

<div class="pm">
    <div class="clearfix" style="margin-top: 20px">
        <div class="open-grid-c2">
            <section class="open-list">
                <table>
                    <caption>数据库一览
                        <a href="javascript:" class="open-detail-btn" style="float: right;margin-top: 10px;margin-right: 20px;" id="submitId">生成代码</a>
                        <input type="text" style="float: right;height:28px;margin-top: 10px;margin-right: 20px;" name="parentPermission">
                    </caption>
                       <thead>
                    <tr style="font-weight: 700;">
                        <th style="width: 40px">选择</th>
                        <th>名称</th>
                        <th>数据库名称</th>
                        <th>创建时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    <!-- for 方法简介 -->
                    <#list model as item>
                        <tr>
                            <td><input type="checkbox" name="select_table" value="${item.tableName}"/></td>
                            <td>${item.tableComment}</td>
                            <td>${item.tableName}</td>
                            <td>${item.createTime}</td>
                        </tr>
                    </#list>
                    </tbody>
                </table>
            </section>
        </div>
    </div>
</div>

<div class="open-footer">
    <ul>

        <li><a href="#">代码生成</a></li>
    </ul>
    <p>备案</p>
</div>
<script type="text/javascript">

    $('#submitId').click(function(){

        var parentPermission = $(" input[ name='parentPermission' ] ").val()
        if(parentPermission.length == 0){
            alert("请输入根权限名称！");
            return;
        }

        var tables = new Array();
        $('input:checkbox').each(function() {
            if($(this).is(":checked")){
                tables.push($(this).val());
                // tables = tables + (tables.length > 0?",":"") + $(this).val();
            }
        });
        if(tables.length == 0){
            alert("没有表被选中！");
            return;
        }
        location.href = "../gen/code?tables=" + encodeURIComponent(JSON.stringify(tables)) +
        "&parentPermission=" + encodeURIComponent(JSON.stringify(parentPermission));

    });
</script></body>
</html>
